pub fn convert_base(num_str: &str, to_base: u32) -> String {
    let chars = vec![
        '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
    ];
    let l = num_str.find('(').unwrap();
    let r = num_str.find(')').unwrap();
    let base = num_str[l + 1..r].parse::<u32>().unwrap();
    let mut num = num_str[0..l].chars().fold(0, |total, char| {
        let x: u32 = chars.iter().position(|&c| c == char).unwrap() as u32;
        total * base + x
    });
    let mut res: Vec<char> = Vec::new();
    while num != 0 {
        let idx: usize = ((num % to_base) as u16).into();
        res.push(chars[idx]);
        num /= to_base;
    };
    res.reverse();
    res.iter().collect()
}
